public class Main25 {
    //、定义水果父类，具有“名称”、“重量”属性和“输出”方法；
    // 定义苹果子类，分别继承父类的属性和方法，并增加本身的方法。
    public static void main(String[] args) {
        Apple apple = new Apple("苹果",10);
        apple.eat();
        apple.Print();
    }
}

class Apple extends Fruit{
    public Apple() {
    }

    public Apple(String name, double weight) {
        super(name, weight);
    }

    @Override
    public void Print() {
        super.Print();
    }

    public void eat(){
        System.out.println("吃" + super.name);
    }

}

class Fruit{
    String name;
    double weight;

    public Fruit() {
    }

    public Fruit(String name, double weight) {
        this.name = name;
        this.weight = weight;
    }

    public void Print() {
        System.out.println("Fruit{" +
                "name='" + name + '\'' +
                ", weight=" + weight +
                '}');
    }
}
